/* challenge-game.css - 闯关游戏页面样式 */

body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: auto;
}

.game-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-title {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #feca57, #48dbfb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-controls {
    display: flex;
    gap: 10px;
}

/* 控制按钮样式 */
.control-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.control-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* 游戏控制面板按钮 */
.btn-game {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
    margin: 5px;
    width: 100%;
    max-width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-game:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.4);
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
}

.btn-game:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

/* 特殊按钮样式 */
.btn-start {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.3);
}

.btn-start:hover {
    background: linear-gradient(135deg, #1976D2 0%, #2196F3 100%);
    box-shadow: 0 10px 30px rgba(33, 150, 243, 0.4);
}

.btn-pause {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.3);
}

.btn-pause:hover {
    background: linear-gradient(135deg, #F57C00 0%, #FF9800 100%);
    box-shadow: 0 10px 30px rgba(255, 152, 0, 0.4);
}

/* 覆盖层按钮样式 */
.btn-overlay {
    background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
    border: none;
    color: white;
    padding: 15px 30px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.3);
    margin: 0 10px;
    min-width: 140px;
}

.btn-overlay:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(156, 39, 176, 0.4);
    background: linear-gradient(135deg, #7B1FA2 0%, #9C27B0 100%);
}

.btn-overlay-success {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.btn-overlay-success:hover {
    background: linear-gradient(135deg, #388E3C 0%, #4CAF50 100%);
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.4);
}

.btn-overlay-danger {
    background: linear-gradient(135deg, #F44336 0%, #D32F2F 100%);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.3);
}

.btn-overlay-danger:hover {
    background: linear-gradient(135deg, #D32F2F 0%, #F44336 100%);
    box-shadow: 0 10px 30px rgba(244, 67, 54, 0.4);
}

.game-content {
    display: flex;
    flex: 1;
    gap: 20px;
    min-height: auto;
    flex-wrap: wrap;
}

/* 游戏区域 - 自适应大小，支持滚动 */
.game-area {
    flex: 3;
    min-width: 640px; /* 600px + padding */
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    position: relative;
    min-height: auto;
}

.game-canvas-container {
    width: 600px;
    height: 600px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

#gameCanvas {
    width: 100%;
    height: 100%;
    background: #000;
    cursor: pointer;
}

/* 游戏画布容器 */
.game-canvas-container {
    width: 600px;
    height: 600px;
    border: 3px solid #4CAF50;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    background: linear-gradient(45deg, #1a1a2e 25%, transparent 25%), 
                linear-gradient(-45deg, #16213e 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #1a1a2e 75%), 
                linear-gradient(-45deg, transparent 75%, #16213e 75%);
    background-size: 40px 40px;
    background-position: 0 0, 0 20px, 20px -20px, -20px 0px;
}

/* 大地图边界标识 */
.game-canvas-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed rgba(76, 175, 80, 0.3);
    pointer-events: none;
    z-index: 1;
}

.game-canvas-container::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: 15px;
    pointer-events: none;
    z-index: 1;
}

/* 游戏面板样式 */
.game-panel {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 小地图容器 */
.mini-map-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 15px;
}

.mini-map-header {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #feca57;
    display: flex;
    align-items: center;
    justify-content: center;
}

#miniMapCanvas {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    border: 2px solid rgba(76, 175, 80, 0.3);
}

/* 统计信息面板 */
.stats-panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-panel .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-panel .stat-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.stats-panel .stat-label {
    color: #ccc;
    font-size: 1rem;
    display: flex;
    align-items: center;
}

.stats-panel .stat-value {
    font-weight: bold;
    font-size: 1.2rem;
    color: #fff;
}

/* 关卡进度 */
.level-progress {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.level-progress .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* 控制面板 */
.controls-panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.control-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* 游戏说明 */
.game-instructions {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.instructions-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #feca57;
    display: flex;
    align-items: center;
}

.instructions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.instructions-list li {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    color: #ccc;
    font-size: 0.9rem;
}

.instructions-list li i {
    margin-right: 8px;
    color: #feca57;
}

/* 游戏底部 */
.game-footer {
    margin-top: 20px;
    text-align: center;
}

/* 响应式布局 */
@media (max-width: 1200px) {
    .game-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-area {
        min-width: auto;
        width: 100%;
        flex: none;
    }
    
    .game-panel {
        min-width: auto;
        max-width: none;
        width: 100%;
        flex: none;
    }
    
    .game-canvas-container {
        width: 100%;
        max-width: 600px;
        height: 600px;
        margin: 0 auto;
    }
    
    .control-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .btn-game {
        max-width: 160px;
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .game-header {
        padding: 15px;
    }
    
    .game-title {
        font-size: 1.5rem;
    }
    
    .game-area {
        padding: 15px;
        min-height: 500px;
    }
    
    .game-canvas-container {
        height: 500px;
        max-width: 500px;
    }
    
    .game-panel {
        padding: 10px;
        gap: 10px;
    }
    
    .control-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-game {
        max-width: none;
        width: 100%;
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .stats-panel .stat-label,
    .stats-panel .stat-value {
        font-size: 0.9rem;
    }
    
    .instructions-list li {
        font-size: 0.8rem;
    }
}

/* 游戏底部 - 固定在左下角 */
.game-footer {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}

.back-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    color: white;
    text-decoration: none;
}

.game-info {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.info-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
}

.info-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #feca57;
}

.info-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    color: #ccc;
    font-size: 0.9rem;
}

.info-value {
    font-weight: bold;
    font-size: 1.1rem;
}

.score-value {
    color: #4CAF50;
}

.level-value {
    color: #2196F3;
}

.lives-value {
    color: #FF9800;
}

.time-value {
    color: #9C27B0;
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.stat-item {
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.stat-label {
    font-size: 0.8rem;
    color: #999;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
}

.mobile-controls {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    margin-top: 20px;
    height: 200px;
}

.mobile-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.mobile-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

.mobile-btn.up {
    grid-column: 2;
    grid-row: 1;
}

.mobile-btn.down {
    grid-column: 2;
    grid-row: 3;
}

.mobile-btn.left {
    grid-column: 1;
    grid-row: 2;
}

.mobile-btn.right {
    grid-column: 3;
    grid-row: 2;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.overlay-content {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    width: 90%;
}

.overlay-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.overlay-message {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #ccc;
    line-height: 1.6;
}

.overlay-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.overlay-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.overlay-btn.primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.overlay-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.overlay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .game-content {
        flex-direction: column;
    }
    
    .game-info {
        order: -1;
        margin-bottom: 20px;
    }
    
    .mobile-controls {
        display: grid;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .game-controls {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }
    
    .game-title {
        font-size: 1.5rem;
    }
    
    .overlay-content {
        padding: 20px;
    }
    
    .overlay-title {
        font-size: 2rem;
    }
}